// JavaScript Document
function colorRgb(code){
    var len=code.length;
    var f=new Array();
    f['0']=0;
    f['1']=1;
    f['2']=2;
    f['3']=3;
    f['4']=4;
    f['5']=5;
    f['6']=6;
    f['7']=7;
    f['8']=8;
    f['9']=9;
    f['A']=10;
    f['B']=11;
    f['C']=12;
    f['D']=13;
    f['E']=14;
    f['F']=15;
    code=code.toLocaleUpperCase();//转换为大写
    var s=code.substr(0,1);
    if(s=='#'){
        code=code.substr(1,6);
    }
    var r=f[code[0]]*16+f[code[1]];
    var g=f[code[2]]*16+f[code[3]];
    var b=f[code[4]]*16+f[code[5]];
    return [r,g,b];
}
function color16(code){
	code[0]=code[0] > 255 ? 255 : code[0];
	code[1]=code[1] > 255 ? 255 : code[1];
	code[2]=code[2] > 255 ? 255 : code[2];
    return "#"+( code[0] < 16 ? ("0"+code[0].toString(16)) : code[0].toString(16) )+( code[1] < 16 ? ("0"+code[1].toString(16)) : code[1].toString(16) )+( code[2] < 16 ? ("0"+code[2].toString(16)) : code[2].toString(16) );
}
function colorGradient(code,step){
	var colorRGB=colorRgb(code);
	var colorF=new Array(step);
	var colorV;
	for(var i=0;i<step;i++){
		colorV=1+1/step*i;
		colorF[i]=color16([parseInt(colorRGB[0]*colorV),parseInt(colorRGB[1]*colorV),parseInt(colorRGB[2]*colorV)])	;
		//console.info(colorF[i])
	}
	return colorF
}